<%--
  Created by IntelliJ IDEA.
  User: 小可爱
  Date: 2020/9/25
  Time: 14:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
    <head>
        <title>Title</title>
        <script  src="js/jquery-3.4.1.min.js"></script>
    </head>
    <body>

        <a href="member/getById?id=101&name=smith">查询某个用户</a> <%--①客户端请求:a/b的形式--%>

        <h2>添加新用户</h2>
        <form action="member/save" method="post">
            用户id:<input type="text" name="memberId"/> <br>
            用户名:<input type="text" name="memberName"/><br>
            用户手机号:<input type="text" name="memberTelno"/><br>
            用户密码:<input type="text" name="password"/><br>
            用户邮箱:<input type="text" name="postbox"/><br>
            用户积分:<input type="text" name="score"/><br>

            <input type="submit" value="保存"/>
        </form>

    <%--要求返回JSON数据--%>
        <a href="javascript:void(0)" class="btn1">查询 fun1</a>
        <script>
            $(".btn1").click(function () {
                $.ajax({
                    type:"get",
                    url:"jsonDemo/fun1",
                    dataType:"json",
                    data:"id=1011&memberName=Rose",
                    success:function(result){
                        console.log(JSON.stringify(result));
                    }
                });
            });
        </script>

        <a href="javascript:void(0)" class="btn2">查询 fun2</a>
        <script>
            $(".btn2").click(function () {
                $.ajax({
                    type:"get",
                    url:"jsonDemo/fun2",
                    dataType:"json",
                    data:"id=1011&memberName=Rose",
                    success:function(result){
                        console.log(JSON.stringify(result));
                    }
                });
            });
        </script>
    </body>
</html>
